package cn.hrlly.tao2shou.presenter;

import cn.hrlly.tao2shou.biz.PublishRequireBiz;
import cn.hrlly.tao2shou.biz.PublishRequireBizImpl;
import cn.hrlly.tao2shou.domain.Require;
import cn.hrlly.tao2shou.listener.OnPublishRequireListener;
import cn.hrlly.tao2shou.view.view_interface.PublishRequireView;

/**
 * User: gengliang
 * Date: 2016-01-30
 * Time: 11:18
 */

public class PublishRequirePresenterImpl implements PublishRequirePresenter,OnPublishRequireListener {

    private PublishRequireBiz publishRequireBiz;
    private PublishRequireView publishRequireView;

    public PublishRequirePresenterImpl(PublishRequireView publishRequireView){
        this.publishRequireBiz=new PublishRequireBizImpl(this);
        this.publishRequireView=publishRequireView;
    }

    @Override
    public void publishRequire() {
        Require require=new Require();
        require.setRequireTitle(publishRequireView.getRequireTitle());
        require.setRequireDescription(publishRequireView.getRequireDescription());
        require.setAcceptablePrice(publishRequireView.getAcceptablePrice());
        publishRequireBiz.getNetPublishRequire(require);
    }

    @Override
    public void publishRequireSucc(String message) {
        publishRequireView.showMessage(message);
        publishRequireView.finishActivity();
    }

    @Override
    public void publishRequireSucc(int message) {
        publishRequireView.showMessage(message);
        publishRequireView.finishActivity();
    }

    @Override
    public void publishRequireFail(String errorMessage) {
        publishRequireView.showMessage(errorMessage);
    }

    @Override
    public void publishRequireFail(int errorMessage) {
        publishRequireView.showMessage(errorMessage);
    }
}
